   Ext.namespace('Ext.airdata');
   
   //运输方式
   Ext.airdata.transportTypeData = [
    ['1','送货'],
    ['2','不送货']
   ];

  
   var store_transportType = new Ext.data.ArrayStore({
        fields: ['id', 'name'],
        data : Ext.airdata.transportTypeData
    });
 function getTransportTypeCombo(){
   var combo_transportType = new Ext.form.ComboBox({
	    fieldLabel:'运输方式',
        store: store_transportType,
        displayField:'name',
        valueField:'id',
        hiddenName:'transportType',
        typeAhead: true,
        mode: 'local',
        forceSelection: true,
        triggerAction: 'all',
        emptyText:'请选择',
        anchor : '100%',
        selectOnFocus:true,
		editable:false,
		allowBlank : false
    }); 
    return combo_transportType;
    
 }
   
   //销售单位
   var store_partner=new Ext.data.JsonStore({
    		url : app.url+'/admin/com/partnerList.do',
    		root:'root',
    		autoLoad:'true',
    		totalProperty: "totalProperty",
			baseParams:{start:0,limit:10},
    		fields:[
    			{name : 'id',type:'int'},
    			{name : 'companyName',type:'string'}
    		]
		});
function getPartnerCombo(){
   var  combo_partner = new Ext.form.ComboBox({
        fieldLabel : '销售单位',
        store: store_partner,
        displayField:'companyName',
		valueField:'id',
		hiddenName:'partnerId',
        typeAhead: false,
        mode: 'remote',
        triggerAction: 'all',
        emptyText:'请选择',
        minChars:3,
		pageSize:10,
		anchor : '100%',
        selectOnFocus:true,
		forceSelection  :true,
		queryParam:'queryParam',
		allowBlank : false
   });
   return combo_partner;
   
}
   
  
   
   //单据类型
  Ext.airdata.invoicesTypeData = [
    ['1','一般'],
    ['2','加急']
   ];

  
   var store_invoicesType = new Ext.data.ArrayStore({
        fields: ['id', 'name'],
        data : Ext.airdata.invoicesTypeData
    });
	

    var combo_invoicesType_grid = new Ext.form.ComboBox({
        store: store_invoicesType,
        displayField:'name',
        valueField:'id',
        typeAhead: true,
        mode: 'local',
        forceSelection: true,
        triggerAction: 'all',
        emptyText:'请选择',
		anchor : '100%',
        selectOnFocus:true,
		editable:false,
		allowBlank : false
    });	
    
 function getInvoicesTypeCombo() {
	var combo_invoicesType = new Ext.form.ComboBox({
	    fieldLabel:'单据类型',
        store: store_invoicesType,
        displayField:'name',
        valueField:'id',
        hiddenName:'invoicesType',
        typeAhead: true,
        mode: 'local',
        forceSelection: true,
        triggerAction: 'all',
        emptyText:'请选择',
		anchor : '100%',
        selectOnFocus:true,
		editable:false,
		allowBlank : false
    });
   return  combo_invoicesType;
}   
    
    //区县
    var store_district=new Ext.data.JsonStore({
    		url : app.url+'/admin/area/district.do',
    		root:'root',
    		autoLoad:true,
    		fields:[
    			{name : 'id',type:'int'},
    			{name : 'district',type:'string'}
    		]
		});
function getDistrictCombo(){
   var  combo_district = new Ext.form.ComboBox({
        fieldLabel : '地理位置',
        store: store_district,
        displayField:'district',
		valueField:'id',
		hiddenName:'districtId',
        typeAhead: false,
        mode: 'remote',
        triggerAction: 'all',
        emptyText:'请选择',
		anchor : '100%',
        selectOnFocus:true,
		forceSelection  :true,
		allowBlank : false
   });
   return combo_district;
}

   
   //单位
    var store_unit=new Ext.data.JsonStore({
    		url : app.url+'/admin/sys/unitList.do',
    		root:'root',
    		autoLoad:true,
    		fields:[
    			{name : 'id',type:'int'},
    			{name : 'name',type:'name'}
    		]
		});
function getUnitCombo() {
	var combo_unit = new Ext.form.ComboBox({
	    fieldLabel:'单位',
        store: store_unit,
        displayField:'name',
        valueField:'name',
        hiddenName:'unit',
        typeAhead: true,
        mode: 'local',
        forceSelection: true,
        triggerAction: 'all',
        emptyText:'请选择',
		anchor : '100%',
        selectOnFocus:true,
		editable:false,
		allowBlank : false
    });
   return  combo_unit;
} 

 //品牌
    var store_brand=new Ext.data.JsonStore({
    		url : app.url+'/admin/sys/barndList.do',
    		root:'root',
    		autoLoad:true,
    		fields:[
    			{name : 'id',type:'int'},
    			{name : 'name',type:'name'}
    		]
		});
function getBrandCombo() {
	var combo_unit = new Ext.form.ComboBox({
	    fieldLabel:'品牌',
        store: store_brand,
        displayField:'name',
        valueField:'name',
        hiddenName:'brand',
        typeAhead: true,
        mode: 'local',
        forceSelection: true,
        triggerAction: 'all',
        emptyText:'请选择',
		anchor : '100%',
        selectOnFocus:true,
		editable:false,
		allowBlank : false
    });
   return  combo_unit;
} 


 //功率
    var store_Power=new Ext.data.JsonStore({
    		url : app.url+'/admin/sys/powerList.do',
    		root:'root',
    		autoLoad:true,
    		fields:[
    			{name : 'id',type:'int'},
    			{name : 'name',type:'name'}
    		]
		});
function getPowerCombo() {
	var combo_unit = new Ext.form.ComboBox({
	    fieldLabel:'功率',
        store: store_Power,
        displayField:'name',
        valueField:'name',
        hiddenName:'power',
        typeAhead: true,
        mode: 'local',
        forceSelection: true,
        triggerAction: 'all',
        emptyText:'请选择',
		anchor : '100%',
        selectOnFocus:true,
		editable:false,
		allowBlank : false
    });
   return  combo_unit;
} 



 //功能
    var store_function=new Ext.data.JsonStore({
    		url : app.url+'/admin/sys/functionList.do',
    		root:'root',
    		autoLoad:true,
    		fields:[
    			{name : 'id',type:'int'},
    			{name : 'name',type:'name'}
    		]
		});
function getFunctionCombo() {
	var combo_unit = new Ext.form.ComboBox({
	    fieldLabel:'功能',
        store: store_function,
        displayField:'name',
        valueField:'name',
        hiddenName:'functionName',
        typeAhead: true,
        mode: 'local',
        forceSelection: true,
        triggerAction: 'all',
        emptyText:'请选择',
		anchor : '100%',
        selectOnFocus:true,
		editable:false,
		allowBlank : false
    });
   return  combo_unit;
} 
 //能效
    var store_seer=new Ext.data.JsonStore({
    		url : app.url+'/admin/sys/seerList.do',
    		root:'root',
    		autoLoad:true,
    		fields:[
    			{name : 'id',type:'int'},
    			{name : 'name',type:'name'}
    		]
		});
function getSeerCombo() {
	var combo_unit = new Ext.form.ComboBox({
	    fieldLabel:'能效',
        store: store_seer,
        displayField:'name',
        valueField:'name',
        hiddenName:'seer',
        typeAhead: true,
        mode: 'local',
        forceSelection: true,
        triggerAction: 'all',
        emptyText:'请选择',
		anchor : '100%',
        selectOnFocus:true,
		editable:false,
		allowBlank : false
    });
   return  combo_unit;
} 

 //类别
    var store_category=new Ext.data.JsonStore({
    		url : app.url+'/admin/sys/categoryList.do',
    		root:'root',
    		autoLoad:true,
    		fields:[
    			{name : 'id',type:'int'},
    			{name : 'name',type:'name'}
    		]
		});
function getCategoryCombo() {
	var combo_unit = new Ext.form.ComboBox({
	    fieldLabel:'类别',
        store: store_category,
        displayField:'name',
        valueField:'name',
        hiddenName:'category',
        typeAhead: true,
        mode: 'local',
        forceSelection: true,
        triggerAction: 'all',
        emptyText:'请选择',
		anchor : '100%',
        selectOnFocus:true,
		editable:false,
		allowBlank : false
    });
   return  combo_unit;
} 


//维修方式
   //运输方式
   Ext.airdata.repairTypeData = [
    ['1','上门'],
    ['2','拉修']
   ];

  
   var store_repairType = new Ext.data.ArrayStore({
        fields: ['id', 'name'],
        data : Ext.airdata.repairTypeData
    });
 function getRepairTypeCombo(){
   var combo_repairType = new Ext.form.ComboBox({
	    fieldLabel:'维修方式',
        store: store_repairType,
        displayField:'name',
        valueField:'id',
        hiddenName:'repairType',
        typeAhead: true,
        mode: 'local',
        forceSelection: true,
        triggerAction: 'all',
        emptyText:'请选择',
        anchor : '100%',
        selectOnFocus:true,
		editable:false,
		allowBlank : false
    }); 
    return combo_repairType;
 }
 
 //仓库
 var store_storage=new Ext.data.JsonStore({
    		url : app.url+'/admin/com/storageList.do',
    		root:'root',
    		autoLoad:true,
    		fields:[
    			{name : 'id',type:'int'},
    			{name : 'name',type:'string'}
    		]
		});
function getStorageCombo(isBlank){
   if(typeof isBlank=='undefined') isBlank=false;
   var  combo_storage = new Ext.form.ComboBox({
        fieldLabel : '仓库',
        store: store_storage,
        displayField:'name',
		valueField:'id',
		hiddenId:'storageId_'+new Date().getTime(),
		hiddenName:'storageId',
        typeAhead: false,
        mode: 'remote',
        triggerAction: 'all',
        emptyText:'请选择',
		anchor : '100%',
        selectOnFocus:true,
		forceSelection  :true,
		allowBlank : isBlank
   });
   return combo_storage;
}
//故障现象
 var store_bug=new Ext.data.JsonStore({
    		url : app.url+'/admin/com/bugList.do',
    		root:'root',
    		autoLoad:'true',
    		totalProperty: "totalProperty",
			baseParams:{start:0,limit:10},
    		fields:[
    			{name : 'id',type:'int'},
    			{name : 'name',type:'string'}
    		]
		});
function getBugCombo(){
   var  combo_bug = new Ext.form.ComboBox({
        fieldLabel : '故障现象',
        store: store_bug,
        displayField:'name',
		valueField:'name',
		hiddenName:'bugId',
        typeAhead: false,
        mode: 'remote',
        triggerAction: 'all',
        emptyText:'请选择',
        minChars:3,
		pageSize:10,
		anchor : '100%',
        selectOnFocus:true,
		forceSelection  :true,
		allowBlank : false
   });
   return combo_bug;
   
}
//员工
 var store_employee=new Ext.data.JsonStore({
    		url : app.url+'/admin/employeeList.do',
    		root:'root',
    		autoLoad:true,
    		fields:[
    			{name : 'id',type:'int'},
    			{name : 'name',type:'name'}
    		]
		});
//司机
function getDriverCombo(){	   
	var  combo_employee = new Ext.form.ComboBox({
        fieldLabel : '司机',
        store: store_employee,
        displayField:'name',
		valueField:'id',
		hiddenName:'driverId',
        typeAhead: false,
        mode: 'remote',
		minChars:3,
        triggerAction: 'all',
        emptyText:'请选择',
		anchor : '100%',
        selectOnFocus:true,
		forceSelection  :true,
		allowBlank : false
   });
   return combo_employee;
}
	
function getEmployeeCombo(fieldLabel,isBlank){	  
	if(typeof isBlank=='undefined') isBlank=false; 
	var  combo_handler = new Ext.form.ComboBox({
		fieldLabel : fieldLabel,
        store: store_employee,
        displayField:'name',
		valueField:'id',
		hiddenName:'handler',
        typeAhead: false,
        mode: 'remote',
		minChars:3,
        triggerAction: 'all',
        emptyText:'请选择',
		anchor : '100%',
        selectOnFocus:true,
		forceSelection  :true,
		allowBlank : isBlank
   });
   return combo_handler;
}

	 var store_car=new Ext.data.JsonStore({
    		url : app.url+'/admin/com/carList.do',
    		root:'root',
    		autoLoad:true,
    		fields:[
    			{name : 'id',type:'int'},
    			{name : 'carCode',type:'string'}
    		]
		});
function getCarCombo(){	   
	var  combo_car = new Ext.form.ComboBox({
        fieldLabel : '车辆',
        store: store_car,
        displayField:'carCode',
		valueField:'carCode',
		hiddenName:'carCode',
        typeAhead: false,
        mode: 'remote',
		minChars:3,
        triggerAction: 'all',
        emptyText:'请选择',
		anchor : '100%',
        selectOnFocus:true,
		forceSelection  :true,
		allowBlank : false
   });
   return combo_car;
}
 //服务方式
   Ext.airdata.serverTypeData = [
    ['1','保内'],
    ['2','保外'],
    ['3','安装问题']
   ];

  
   var store_serverType = new Ext.data.ArrayStore({
        fields: ['id', 'name'],
        data : Ext.airdata.serverTypeData
    });
 function getServerTypeCombo(){
   var combo_serveType = new Ext.form.ComboBox({
	    fieldLabel:'服务类型',
        store: store_serverType,
        displayField:'name',
        valueField:'id',
        hiddenName:'serveType',
        typeAhead: true,
        mode: 'local',
        forceSelection: true,
        triggerAction: 'all',
        emptyText:'请选择',
		anchor : '100%',
        selectOnFocus:true,
		editable:false,
		allowBlank : false
    }); 
    return combo_serveType;    
 }
  
 
 //配件
 
 	 var store_part=new Ext.data.JsonStore({
    		url : app.url+'/admin/partList.do',
    		root:'root',
    		autoLoad:true,
    		fields:[
    			{name : 'id',type:'int'},
    			{name : 'name',type:'string'}
    		]
		});
 
 function getPartCombox(fieldLabel){
 		var part_combox = new Ext.form.ComboBox({
 			fieldLabel:fieldLabel,
        	store: store_part,
       	    displayField:'name',
        	valueField:'id',
        	hiddenName:'partId',
        	typeAhead: true,
       	 	mode: 'remote',
        	forceSelection: true,
        	triggerAction: 'all',
        	emptyText:'请选择',
        	queryDelay:10,
			anchor : '100%',
        	selectOnFocus:true,
			editable:false,
			allowBlank : false
 		});
 		return part_combox;
 }
 //商品
   var store_goods=new Ext.data.JsonStore({
    		url : app.url+'/admin/com/goodsList.do',
    		root:'root',
    		autoLoad:'true',
    		totalProperty: "totalProperty",
			baseParams:{start:0,limit:10},
    		fields:[
    			{name : 'id',type:'int'},
    			{name : 'name',type:'string'}
    		]
		});
		
function getGoodsCombo(isBlank){
   var  combo_partner = new Ext.form.ComboBox({
        fieldLabel : '商品名称',
        store: store_goods,
        displayField:'name',
		valueField:'id',
		hiddenId:'goodsId_'+new Date().getTime(),
		hiddenName:'goodsId',
        typeAhead: false,
        mode: 'remote',
        triggerAction: 'all',
        emptyText:'请选择',
        minChars:3,
		pageSize:10,
		anchor : '100%',
        selectOnFocus:true,
		forceSelection  :true,
		queryParam:'queryParam',
		allowBlank : isBlank
   });
   return combo_partner;
   
} 

 //产品
   var store_product=new Ext.data.JsonStore({
    		url : app.url+'/admin/productList.do',
    		root:'root',
    		autoLoad:'true',
    		totalProperty: "totalProperty",
			baseParams:{start:0,limit:10},
    		fields:[
    			{name : 'id',type:'int'},
    			{name : 'name',type:'string'},
    			{name : 'brand',type:'string'},
    			{name : 'typeCode',type:'string'}
    		]
		});
		

var productTpl = new Ext.XTemplate(
        '<tpl for="."><div class="search-item">',
            '{name}&nbsp;&nbsp;{brand}&nbsp;&nbsp;{typeCode}',
        '</div></tpl>'
    );		
		
function getProductCombo(isBlank){
   var  combo_product = new Ext.form.ComboBox({
        fieldLabel : '产品名称',
        store: store_product,
        displayField:'name',
		valueField:'id',
		hiddenName:'goodsId',
		tpl: productTpl,
		itemSelector: 'div.search-item',
        typeAhead: false,
        mode: 'remote',
        triggerAction: 'all',
        emptyText:'请选择',
        minChars:3,
		pageSize:10,
		anchor : '100%',
        selectOnFocus:true,
		forceSelection  :true,
		queryParam:'queryParam',
		allowBlank : isBlank
   });
   return combo_product;
   
} 